package com.xybbs.provider;

import org.apache.ibatis.jdbc.SQL;

import com.xybbs.entity.Users;

public class UserProvider {
	
	public String insert(Users user) {
		//@Insert("insert into user(userName,userNick,userPassword,userType) values(#{userName},#{userNick},#{userPassword},#{userType})")
		return new SQL() {
			{
				INSERT_INTO("user");
				VALUES("userName", "#{userName}");
				VALUES("userNick", "#{userNick}");
				VALUES("userPassword", "#{userPassword}");
				if(user.getUserType()==null) {
					VALUES("userType", "2");
				}else {
					VALUES("userType","#{userType}");
				}
				
			}
		}.toString();
	}

}
